package com.ganeshkrishnan.globald.dao.hibernate;

import java.util.List;

import com.ganeshkrishnan.globald.abstracts.GenericDaoHibernate;
import com.ganeshkrishnan.globald.dao.NominationDao;
import com.ganeshkrishnan.globald.model.Nomination;

public class NominationDaoHibernate extends GenericDaoHibernate<Nomination, Long> implements NominationDao {
	public NominationDaoHibernate() {
		super(Nomination.class);
	}

	public List<Nomination> findNominationByPersonID(Long PersonID) {
		return getHibernateTemplate().find("from Nomination where PersonID=?", PersonID);
	}

	//TODO replace with save
	public Nomination UpdateNomination(Nomination nom) {
		getHibernateTemplate().saveOrUpdate(nom);
		getHibernateTemplate().flush();
		return nom;
	}

	//TODO replace with remove
	public void deleteNomination(Nomination nom) {
		getHibernateTemplate().delete(nom);
		getHibernateTemplate().flush();
		return;
	}
}
